#include "passwordcheckdialog.h"
#include "ui_passwordcheckdialog.h"

PasswordCheckDialog::PasswordCheckDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::PasswordCheckDialog)
{
    ui->setupUi(this);
        move(0,0);
    isPasswordOk=false;
    isCheckFinished=false;
    correctPassword="123456";

}

PasswordCheckDialog::~PasswordCheckDialog()
{
    delete ui;
}


bool PasswordCheckDialog::getPassWordCheckResult()
{
    return isPasswordOk;
}

bool PasswordCheckDialog::isDialogFinished()
{
    return isCheckFinished;
}

int PasswordCheckDialog::setCorrectPassword(QString passwordIn)
{
    correctPassword=passwordIn;
    return 1;
}

void PasswordCheckDialog::on_pushButton_clicked()
{

    if(ui->lineEdit->text()==correctPassword)
    {
        isPasswordOk=true;
        isCheckFinished=true;
        hide();
        QDialog::accept();
    }
    else
    {
        isPasswordOk=false;
        ui->label_2->setText(tr("密码错误！"));
    }

}

void PasswordCheckDialog::on_pushButton_2_clicked()
{
    isCheckFinished=true;
    hide();
    QDialog::rejected();
}
